home *** CD-ROM | disk | FTP | other *** search
/ Suzy B Software 2 / Suzy B Software CD-ROM 2 (1994).iso / extras / falcon / falclib5 / routs / fade.s < prev    next >
Text File  |  1995-04-27  |  2KB  |  67 lines

  1. *This routine is from:
  2.  
  3. * THE JAGUAR DEMO!
  4. ; Code by Genie and EGB's Smelly Sox!
  5. ; Music by Metronome of Adrenalin!
  6. ; Mod replay by Bitmaster of BSW!
  7. ; This code is (c) 1994 PB Productions!
  8. ; Uses Devpac for the odd bit of 68030 code, uses tabs = 8
  9.  
  10.  
  11. * Fadeit - true colour versh, coded by <Genie!> of Network Trash.
  12. ; Obviously it only works on single pixels!
  13. ;
  14. ; a0 = pointer to colour to change
  15. ; a1 = pointer to target colour
  16. *(destroys d1-d4; adds 2 to a0-a1)
  17.  
  18. *
  19. * Code optimized by Johan Karlsson
  20. *
  21.  
  22.  
  23. @fadetrupix
  24. .red
  25.     move    (a1)+,d1        Get target pixel
  26.     move    (a0),d2            Get pixel to change
  27.     cmp    d1,d2            Is pixel colour the same?
  28.     beq.s    .bye             If so, don't bother- we've finished!
  29.  
  30.     move    d1,d3            {
  31.     move    d2,d4            { --- Isolate R bits
  32.     andi    #%1111100000000000,d3    {
  33.     andi    #%1111100000000000,d4    {
  34.     cmp    d3,d4            Are the R bits the same?
  35.     beq.s    .rok             If so, try the G bits.
  36.     bhi.s    .rsub             If the target pixel has smaller amount of red-|
  37. .radd    addi    #%0000100000000000,d2    Otherwise add an element of red.           |
  38.     bra.s    .rok                                       |
  39. .rsub    subi    #%0000100000000000,d2     ... take away an element of red. <------------|
  40. .rok
  41. .green    move    d1,d3            {
  42.     move    d2,d4            { --- Isolate G bits
  43.     andi    #%11111000000,d3    {
  44.     andi    #%11111000000,d4    {
  45.     cmp    d3,d4            Are the G bits the same?
  46.     beq.s    .gok             If so, try the B bits.
  47.     bhi.s    .gsub             If the target has smaller amount of green-----|
  48. .gadd    add    #%00001000000,d2     Otherwise add an element of green.           |
  49.     bra.s    .gok                                       |
  50. .gsub    subi    #%00001000000,d2     ... take away an element of green. <----------|
  51. .gok
  52. .blue    move    d1,d3            {
  53.     move    d2,d4            { --- Isolate B bits
  54.     andi    #%11111,d3        {
  55.     andi    #%11111,d4        {
  56.     cmp    d3,d4            Are the B bits the same?
  57.     beq.s    .bok             If so, finish.
  58.     bhi.s    .bsub             If the target has smaller amounts of blue-----|
  59. .badd    addq.l    #1,d2             Otherwise add an element of blue.           |
  60.     bra.s    .bok                                       |
  61. .bsub    subq.l    #1,d2             ... take away an element of blue. <-----------|
  62. .bok    move    d2,(a0)+        Put changed pixel on screen.
  63.     rts
  64. .bye    addq.l    #2,a0
  65.     rts
  66.     
  67.